package com.gupaoedu.demo.serialize;

/**
 * <p>
 *
 * </p>
 *
 * @author Nicky
 * @since 2019-07-21
 */
public class SerialDemo {
    public static void main(String[] args) {
//        ISerialize serialize = new JavaSerialize();
//        ISerialize serialize = new XStreamSerializer();
//        ISerialize serialize = new FastJsonSerializer();
        ISerialize serialize = new HessianSerialize();

        User user = new User();
        user.setName("mic");
        user.setAge(18);

        byte[] bytes = serialize.serialize(user);
        System.out.println(new String(bytes));
        System.out.println(bytes.length);  //xml 105 JSON 23 Hessian 61

        User user1 = serialize.deserialize(bytes,User.class);
        System.out.println(user1);


    }
}
